import fetch from 'utils/fetch';
/**
 * 卡券管理
 */
// 卡券总量统计
export function getIncrementCardCouponsNum() {
  const data = {

  };
  return fetch({
      url: '/incrementCard/getIncrementCardCouponsNum',
      method: 'post',
      data
  });
}

// 卡券月统计
export function getIncrementCardCouponsByMonth(page,rows) {
  const data = {
    page,
    rows
  };
  return fetch({
      url: '/incrementCard/getIncrementCardCouponsByMonth',
      method: 'post',
      data
  });
}

// 卡券订单列表
export function pageIncrementCardCoupons(page,rows,provinceId,cityId,areaId,agentName,date) {
    const data = {
        page,
        rows,
        provinceId,
        cityId,
        areaId,
        agentName,
        date
    };
    return fetch({
        url: '/incrementCard/pageIncrementCardCoupons',
        method: 'post',
        data
    });
}

// 获取卡券订单详情
export function getIncrementCardCouponsById(pId) {
    const data = {
        pId
    };
    return fetch({
        url: '/incrementCard/getIncrementCardCouponsById',
        method: 'post',
        data
    });
}

// 分页查询卡券订单明细列表
export function pageCardCouponsDetail(pId,page,rows) {
    const data = {
        pId,
        page,
        rows
    };
    return fetch({
        url: '/incrementCard/pageCardCouponsDetail',
        method: 'post',
        data
    });
}

// 分页查询卡券审核列表
export function pageCardCoupons(page,rows,provinceId,cityId,areaId,agentName,startDate,endDate) {
    const data = {
        page,
        rows,
        provinceId,
        cityId,
        areaId,
        agentName,
        startDate,
        endDate
    };
    return fetch({
        url: '/incrementCard/pageCardCoupons',
        method: 'post',
        data
    });
}

// 审核卡券订单
export function checkCardCoupons(pId,refuse,sReason) {
    const data = {
        pId,
        refuse,
        sReason
    };
    return fetch({
        url: '/incrementCard/checkCardCoupons',
        method: 'post',
        data
    });
}

// 分页查询卡券发放列表
export function pageCardCouponsGrant(page,rows,provinceId,cityId,areaId,fSchoolId,date) {
    const data = {
        page,
        rows,
        provinceId,
        cityId,
        areaId,
        fSchoolId,
        date
    };
    return fetch({
        url: '/grantCard/pageCardCouponsGrant',
        method: 'post',
        data
    });
}

// 单张撤回卡券
export function cancelCardCoupons(pId) {
    const data = {
        pId
    };
    return fetch({
        url: '/grantCard/cancelCardCoupons',
        method: 'post',
        data
    });
}

// 批量撤回卡券
export function batchCancelCardCoupons(pId) {
    const data = {
        pId
    };
    return fetch({
        url: '/grantCard/batchCancelCardCoupons',
        method: 'post',
        data
    });
}

// 批量开通卡券
export function openServiceByBatchNumberId(pId) {
    const data = {
        
    };
    return fetch({
        url: '/incrementCard/openServiceByBatchNumberId/'+pId,
        method: 'post',
        data
    });
}

// 单个开通卡券
export function openServiceByCardId(cardIds) {
    const data = {
        cardIds
    };
    return fetch({
        url: '/incrementCard/openServiceByCardId/',
        method: 'post',
        data
    });
}

// 分页查询卡券发放列表
export function pageCardCouponsExtendDetail(page,rows,fBatchNumberId,sClassid,phone) {
    const data = {
        page,
        rows,
        fBatchNumberId,
        sClassid,
        phone
    };
    return fetch({
        url: '/grantCard/pageCardCouponsDetail',
        method: 'post',
        data
    });
}

// 导出
export function exportCardCoupons(provinceId,cityId,areaId,agentName,startDate,endDate,token){
    console.log('token',token)
    const params = {
        provinceId,
        cityId,
        areaId,
        agentName,
        startDate,
        endDate,
        token
    };
    return fetch({
        url: '/incrementCard/exportCardCoupons',
        method: 'get',
        params
    });
}
